package com.wang.service;

import com.wang.dao.UserDao;
import com.wang.entity.TeacherWork;
import com.wang.entity.User;
import com.wang.entity.Work;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("userService")
public class UserServiceImpl implements UserService{

    @Autowired
    private UserDao userDao;

    public UserDao getUserDao() {
        return userDao;
    }

    public void setUserDao(UserDao userDao) {
        this.userDao = userDao;
    }

    @Override
    public User login(String username, String password) {
        return userDao.findUser(username,password);
    }

    @Override
    public List<User> findMyuser(String username, String password) {
        return userDao.findMyuser(username,password);
    }

    @Override
    public void addUser(User user) {
         userDao.addUser(user);
    }

    @Override
    public void updatePwd(String password,String username) {
        userDao.updatePwd(password,username);
    }

    @Override
    public List<User> selectAll() {
        return userDao.selectAll();
    }

    @Override
    public List<Work> selectStudentWork() {
        return userDao.selectStudentWork();
    }

    @Override
    public User selectTeacher1(String username, String password) {
        return userDao.selectTeacher1(username,password);
    }


    @Override
    public List<Work> selectTeacher3(String cname,String teacher) {
        return userDao.selectTeacher3(cname,teacher);
    }

    @Override
    public void addTeacher(TeacherWork work) {
        userDao.addTeacher(work);
    }

    @Override
    public void delete(int id) {
        userDao.delete(id);
    }
}
